*** University factors: Gender gap in mathematically intensive subjects, Table 8


********************************************************************************
* 
*                              PEER EFFECTS
*
********************************************************************************

clear
use "${data}cleaned_data_y3.dta"
do "${blocks}construct_new_variables"

label variable interaction "Pooled male $\times$ Share female"

reg ns_std_perc_y1 i.type i.ApplyCollege share_female interaction i.Course_NatSci_split if EEMP == 1, vce(robust)
onesided interaction
estadd local course_fe "\checkmark"
estadd local apply_college_fe "\checkmark"
eststo r1


********************************************************************************
* 
*                              OPTIONS
*
********************************************************************************


merge 1:m ApplyID using "${temp}data_papers.dta"
drop if _merge~=3
drop _merge
save "${temp}data_papers_y3_sample.dta", replace

gen compulsory_diss=1 if compulsory==1 | dissertation==1
replace compulsory_diss=0 if compulsory==0 & dissertation==0

label define compulsory 1 "Compulsory" 0 "Optional"
label values compulsory_diss compulsory

areg std_perc i.type##i.compulsory_diss if AcademicPlan=="ECTX", vce(cluster ApplyID) a(ApplyCollege)
estadd local course_fe ""
estadd local apply_college_fe "\checkmark"
eststo r2

esttab r1 r2  using "${tables}gender_gap_test.tex", cells(b(pval(pval) fmt(2)) se(par fmt(2))) keep(2.type share_female interaction 1.compulsory_diss 2.type#1.compulsory_diss) collabels(none) ///
scalars("course_fe Subject FE" ///
"apply_college_fe Application college FE") ///
eqlabels(none) label varwidth(25) nonumbers  posthead("& Peer effects & Compulsory v optional courses \\" "& (1) & (2) \\ \midrule") nonumbers mlabels(none) se(%9.2f) ///
gaps booktabs nonotes ///
replace



